<script setup>
import { onBeforeMount } from 'vue';
import { useRouter, useRoute } from 'vue-router'
import checkLogin from '@/utils/loginCheck.utils'
import Navigation from '@/components/root/Navigation.vue'
import { getCookie, setCookie } from '@/utils/cookie.utils';
import { useStore } from 'vuex'

const router = useRouter()
const store = useStore()

onBeforeMount(() => {
    let user = getCookie('user')
    console.log(user)
    if (user == null || user == 'null') {
        router.push("/login")
        return
    }
    user = JSON.parse(user)
    store.commit('updateUser', user)
})

console.log(import.meta.env.VITE_STATIC_ADDR)


</script>

<template>
    <div id="rootView">
        <Navigation id="navigation" />
        <div id="mainContent">
            <router-view></router-view>
        </div>
    </div>
</template>

<style scoped>
#rootView {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

#navigation {
    width: 15%;
    height: 100%;
    margin-right: 1%;
    box-shadow: var(--el-box-shadow-lighter);

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#mainContent {
    width: 84%;
    height: 98%;
    box-shadow: var(--el-box-shadow-lighter)
}
</style>
